package com.common.enums;

/**
 * @Brief 通用返回编码
 * @Author chenyl
 * @Date 2023-08-01
 * @Version 1.0.0
 */
public enum ResultEnum {
    /**
     * 成功
     */
    SUCCESS(200, "SUCCESS", "操作成功"),
    /**
     * 失败
     */
    FAIL(0, "FAIL", "操作失败"),
    /**
     * 未知错误
     */
    UNKNOWN_ERROR(-1, "UNKNOWN_ERROR", "未知错误"),
    /**
     * 进行断路器
     */
    FEIGN_HYSTRIX(300, "HYSTRIX", "进行断路器"),
    /**
     * 参数错误
     */
    PARAM_ERROR(501, "PARAM_ERROR", "参数错误"),
    /**
     * 参数类型错误
     */
    PARAM_TYPE_ERROR(502, "PARAM_TYPE_ERROR", "参数类型错误"),
    /**
     * 数据为空
     */
    DATA_NULL(591, "DATA_NULL", "数据为空"),
    /**
     * 集合长度为0
     */
    SIZE_ZERO(592, "SIZE_ZERO", "集合长度为0"),
    /**
     * 数据无效
     */
    DATA_USELESS(593, "DATA_USELESS", "数据无效"),
    /**
     * 数据处理失败
     */
    DATA_TREATMENT_FAIL(594, "DATA_TREATMENT_FAIL", "数据处理失败"),
    /**
     * 无权限
     */
    NOT_PERMISSION(601, "NOT_PERMISSION", "无权限"),
    /**
     * sql错误
     */
    SQL_ERROR(801, "SQL_ERROR", "sql错误"),
    /**
     * 数据重复
     */
    DATA_REPETITION(802, "DATA_REPETITION", "数据重复"),
    /**
     * 账户校验失败
     */
    ACCOUNT_VERIFY_ERROR(803, "ACCOUNT_VERIFY_ERROR", "账户校验失败"),
    /**
     * 验证码失效
     */
    VERIFICATION_CODE_INVALID(804, "VERIFICATION_CODE_INVALID", "验证码失效"),
    /**
     * 验证码错误
     */
    VERIFICATION_CODE_ERROR(805, "VERIFICATION_CODE_ERROR", "验证码错误"),
    /**
     * token失效
     */
    TOKEN_INVALID(806, "TOKEN_INVALID", "token失效"),
    /**
     * token错误
     */
    TOKEN_ERROR(807, "TOKEN_ERROR", "token错误");

    private int id;
    private String code;
    private String message;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    ResultEnum(int id, String code, String message) {
        this.id = id;
        this.code = code;
        this.message = message;
    }

    @Override
    public String toString() {
        return "{" +
                "id:" + id +
                ",code:" + code +
                ",message:" + message +
                "}";
    }
}
